package cn.jingzhuan.element.demo.view.util.audio

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent

/**
 * Created by KNOX.
 */
class NotificationCanceledReceiver : BroadcastReceiver() {
  
  override fun onReceive(context : Context?, intent : Intent?) {
    if (intent != null) {
      // 媒体通知被取消后清空当前音频并停止音频服务
      AudioPlayerManager.setupAudio(null)
      val stopIntent = Intent(context, AudioService::class.java)
      context?.stopService(stopIntent)
    }
  }
}